﻿using AutoMapper;
using Pay.IService;
using System;
using System.Linq;
using System.Reflection;

namespace Pay.Token.App_Start {

    //public static class AutoMapperConfig {
    //    public static void Register() {
    //        Mapper.Initialize(MappingConfiguration.Configure);
    //    }
    //}

    //public static class MappingConfiguration {
    //    public static void Configure(IMapperConfigurationExpression cfg) {
    //        //cfg.CreateMissingTypeMaps = true;
    //        //cfg.EnableNullPropagationForQueryMapping = true;
    //        var assemblie = Assembly.GetExecutingAssembly();
    //        var query = from t in assemblie.GetTypes()
    //                    where t.IsClass && t.GetInterface(typeof(IStartupDto).FullName) != null
    //                    select t;
    //        foreach (Type type in query) {
    //            var task = (IStartupDto)Activator.CreateInstance(type, cfg);
    //            task.Execute();
    //        }
    //        //var assemblies = new Assembly[] { Assembly.Load("Mall.Service") };

    //        //foreach (var assemblie in assemblies) {
    //        //	var query = from t in assemblie.GetTypes()
    //        //				where t.IsClass && t.GetInterface(typeof(IStartupDto).FullName) != null
    //        //				select t;
    //        //	foreach (Type type in query) {
    //        //		var task = (IStartupDto)Activator.CreateInstance(type, cfg);
    //        //		task.Execute();
    //        //	}
    //        //}
    //    }
    //}
}